/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.base.entity.taccount;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;
import com.jeesite.modules.sys.entity.User;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;

/**
 * 会计科目Entity
 * @author shengbin
 * @version 2021-03-29
 */
@Table(name="t_account", alias="a", columns={
		@Column(name="account_id", attrName="accountId", label="编号", isPK=true),
		@Column(name="account_name", attrName="accountName", label="会计科目", queryType=QueryType.LIKE),
		@Column(name="account_number", attrName="accountNumber", label="科目编码", queryType=QueryType.LIKE),
		@Column(name="group_id", attrName="groupId", label="SAP_GROUPID", queryType=QueryType.LIKE),
		@Column(name="is_cashflow", attrName="isCashflow", label="是否现金流量科目"),
		@Column(name="is_bank", attrName="isBank", label="是否是银行科目"),
		@Column(name="create_by", attrName="createBy", label="创建者", isUpdate=false),
		@Column(name="create_date", attrName="createDate", label="创建时间", isUpdate=false),
		@Column(name="update_by", attrName="updateBy", label="更新者", isQuery=false),
		@Column(name="update_date", attrName="updateDate", label="更新时间", isQuery=false),
		@Column(name="remarks", attrName="remarks", label="备注信息"),
	},joinTable = {
        @JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = User.class, attrName = "createByUser", alias = "createby",
                on = "createby.user_code = a.create_by", columns = {
                @Column(name = "user_code", label = "用户编码", isPK = true),
                @Column(name = "user_name", label = "用户名称", isQuery = false),
        }),
        @JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = User.class, attrName = "updateByUser", alias = "updateby",
                on = "updateby.user_code = a.update_by", columns = {
                @Column(name = "user_code", label = "用户编码", isPK = true),
                @Column(name = "user_name", label = "用户名称", isQuery = false),
        }),
}, orderBy="a.update_date DESC"
)
public class Taccount extends DataEntity<Taccount> {
	
	private static final long serialVersionUID = 1L;
	private String accountId;		// 编号
	private String accountName;		// 会计科目
	private String accountNumber;		// 科目编码
	private String groupId;		// SAP_GROUPID
	private String isCashflow;		// 是否现金流量科目
	private String isBank;		// 是否是银行科目
    private User createByUser;
    private User updateByUser;


	public String getIsBank() {
		return isBank;
	}

	public void setIsBank(String isBank) {
		this.isBank = isBank;
	}

	public Taccount() {
		this(null);
	}

	public Taccount(String id){
		super(id);
	}
	
	public String getAccountId() {
		return accountId;
	}

	public void setAccountId(String accountId) {
		this.accountId = accountId;
	}
	
	@NotBlank(message="会计科目不能为空")
	@Length(min=0, max=255, message="会计科目长度不能超过 255 个字符")
	public String getAccountName() {
		return accountName;
	}

	public void setAccountName(String accountName) {
		this.accountName = accountName;
	}
	
	@NotBlank(message="科目编码不能为空")
	@Length(min=0, max=255, message="科目编码长度不能超过 255 个字符")
	public String getAccountNumber() {
		return accountNumber;
	}

	public void setAccountNumber(String accountNumber) {
		this.accountNumber = accountNumber;
	}
	
	@NotBlank(message="SAP_GROUPID不能为空")
	@Length(min=0, max=255, message="SAP_GROUPID长度不能超过 255 个字符")
	public String getGroupId() {
		return groupId;
	}

	public void setGroupId(String groupId) {
		this.groupId = groupId;
	}
	
	@Length(min=0, max=1, message="是否现金流量科目长度不能超过 1 个字符")
	public String getIsCashflow() {
		return isCashflow;
	}

	public void setIsCashflow(String isCashflow) {
		this.isCashflow = isCashflow;
	}

    public User getCreateByUser() {
        return createByUser;
    }

    public void setCreateByUser(User createByUser) {
        this.createByUser = createByUser;
    }

    public User getUpdateByUser() {
        return updateByUser;
    }

    public void setUpdateByUser(User updateByUser) {
        this.updateByUser = updateByUser;
    }
}